Skip to content

0.10.12: a pair's cluster service restarts into the installed release after an update - #2033

Merged
jonathan308 merged 4 commits into
release/candidate-0.10.12dfrom
fix/pair-update-service-restart
Nov 12, 2026
Merged

jonathan308 merged 4 commits into
release/candidate-0.10.12dfrom
fix/pair-update-service-restart

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Draft for the 0.10.12 publish (W1-D2), into release/candidate-0.10.12d (0b52123a18).

Why

W1 on DevNet 0.10.12-dev.branch.176 (pair-2: M3 Ultra Studio + M5 Max MacBook, a pair serving only on its local API; W1-0112.md W1-D2): after darkbloom-dev update on both Macs, both cluster services (supervisor and service) stayed on 0.10.10-dev.branch.175. The parts and workers ran .176. update again said "Already up to date"; restart restarted only the parts. Only launchctl kickstart -k of the service's job fixed it.

Cause (file:line at 0b52123a18; ClusterPairUpdateCycle.swift and UpdateCommand.swift are byte-identical at v0.10.11)

  • darkbloom update installs, then asks the supervisor (cluster service --supervise, launchd job io.darkbloom.cluster-service[.dev].<12 hex>) to restart into the release (UpdateCommand.swift:315-323). The supervisor restarts only at the end of the pair's cycle (ClusterMemberSupervisor.swift:634-643 restartForUpdate → :176-181 → :503-513 execv).
  • The cycle refuses a pair that serves only on its local API, or a solo part: ClusterPairUpdateCycle.livePart returns .undrainable (ClusterPairUpdateCycle.swift:612). The cycle then refuses to stage (:309) or to drain (:365-366, :420) and ends deferred (W1's log: "this Mac's part does not drain for an update").
  • The old service still re-plans once both Macs have the new worker (ClusterService.swift:1385-1430, "Darkbloom changed on both Macs"), so it starts the parts from the installed binary while it keeps running the old one.
  • Nothing else restarts the job: KeepAlive is {SuccessfulExit: false} with RunAtLoad (ClusterServiceAgentPlan.swift:146-151). update with nothing to install prints "Already up to date" and returns (UpdateCommand.swift:145-146). restart stops and serves the pair through the running service (RestartCommand.swift:91-98, ClusterPairCommands.swift:193-218).
  • The update to a release is decided by the release it updates from, so the fleet's update to 0.10.12 runs 0.10.11's cycle, which does the same.

Coordinator-paired parts answer the drain (StartCommand+ClusterMember.swift:142), so those pairs restart through the cycle and aren't affected. Production pairs are coordinator-paired: none is serving now, and 7 accounts had one in the last 7 days.

Production-only symptom. Production's versions compare numerically, which DevNet's 0.10.x-dev.branch.N strings don't (ClusterOnboardingFlow.swift:1303-1314). So on the leading Mac, the 0.10.12 CLI compares itself with the other Mac's stale service (ClusterOnboardingLive+VersionSplit.swift:9-19) and reports "the two Macs run different Darkbloom versions" (ClusterOnboardingLive.swift:2463, a final reason at ClusterPairSummary.swift:555). Its remedy is darkbloom update on the other Mac, which only says "Already up to date". This is from reading the code, not reproduced: W1's DevNet build can't show it.

Fix

ClusterServiceStaleRestart (ProviderCore/Service/ClusterSupervision) runs first in a cluster part: start (rank 0, a coordinator-paired part, a solo server) and cluster link-follower. These are the first processes of the installed release on such a Mac, and they start before the pair takes any request. A part restarts its service's launchd job (launchctl kickstart -k, in the background) only when all of these hold:

  • its heartbeat file is part-health.json (ClusterService.partEnvironment; 0.10.11's service passes the same);
  • the supervisor's service-supervisor.json names an older release than the part (SemanticVersion, DevNet build numbers included);
  • the part's parent is the service that supervisor runs (current.pid);
  • the supervisor is the process this build's job runs (launchctl print pid);
  • no part asked for this release in the last 6 h. The ask is recorded in service-restart-asked.json first; if the record can't be written, the part doesn't ask, and its log says so.

The part then starts nothing for up to 20 s, with SIGTERM and SIGINT at their default action (waitForStop), so the service's stop ends it at once, before it loads a model.

  • A start part runs under the AppKit host. Its ProviderSignalHandler has already taken both signals for the provider's own drain (ignored, read by dispatch sources), so without this the stop was only noted and the part slept the whole wait. This corrects the first version's claim that SIGTERM ended a part with no handler yet; that held only for cluster link-follower.
  • A part that nothing stopped gets its handlers back and starts as before.

The service stops as at a logout and keeps the pair's saved start, and the new supervisor starts the pair again on the installed release: W1's manual kickstart at 06:23:19Z did exactly this. Any other process returns at once without reading a file.

Risks, and how this limits them:

  • Restart loop: at most one ask per release per 6 h per Mac, and no ask without its record. It never asks for a supervisor on the same or a newer release (a rollback), for a supervisor started from a terminal, or for another build's job (DevNet and production have their own folders and labels).
  • Killing a pair mid-request: the check runs only at a part's start, and a pair serves only once both parts are up. Coordinator pairs normally get a new supervisor from the cycle before their parts start, so they never ask.
  • Owners' local-only pairs: one extra restart per Mac, right after the update's own re-plan (W1: ~20 s back to serving, plus the model load).

Docs: cluster-always-on.md (the coordinated update, step 4, and troubleshooting), two-mac-cluster.md, cli-reference.md (darkbloom update). Changelog fragment changelog.d/cluster-service-restart-after-update.md.

Review delta (review-2033.md S1–S3), a6d3e6beb5..16b1a18bda

  • S1: the wait gives SIGTERM and SIGINT their default action, then gives them back what they had (above).
  • S2: there is no ask without the 6 h record.
  • S3: the reviewer's four cases, plus two more:
    • the order is the releases' (SemanticVersion), never the text's: DevNet build 99 → 100 and 176 → 177 (W1's morning case), 0.10.9 → 0.10.10 and 0.10.12, 0.10.9-dev → 0.10.12-dev, each in reverse, and equal versions: 11 cases;
    • a newer installed release asks again within 6 h;
    • print asks for this build's label, and the record is on disk when launchd is asked;
    • a supervisor with no service running (before a re-exec) is left alone;
    • kickstart -k is what launchctl gets, and a refusal is logged (kickInBackground takes its runner);
    • an ask that can't be recorded isn't made.
  • Two exit tests (child processes, since signals are process-wide):
    • under the AppKit host's handling, a SIGTERM during the wait ends the process;
    • after a wait that nothing stopped, the handlers are back.
  • Docs: cluster-always-on.md step 4 (the release order, the parent check, the record before the ask, the wait's signals).

Tests (red first)

Review delta:

  • Red 6ceeb398e9: the new tests, plus two seams that keep today's behaviour (waitForStop is the plain sleep, and kickInBackground takes its runner). CI on it alone: DO NOT MERGE: red run for #2033's review delta (S1-S3) #2036 (DO NOT MERGE). Locally, with the reviewer's harness (the real file and its real dependencies, swift-testing), exactly two tests fail: the S2 test (3 issues) and the S1 exit test (expected .signal(SIGTERM), got exit 0 after the 5 s wait). The rest pass.
  • Green 16b1a18bda: 15 tests (with the 11 order cases) pass locally.
  • The reviewer's mutants, re-pointed at the new code, plus three for the delta, are all killed except M19, which drops the wait call in the public wrapper; no unit test reaches that, and W1 does. Killed: string order (M4), the record keyed on the supervisor's release (M9), asking before recording (M12), print of another job (M15), kickstart without -k (M17), the wait leaving the signals as they are, no restore, and asking despite a failed record.
  • ProviderCore emits and darkbloom typechecks against the release build's modules. changelog, docs-impact and check-date-comparisons pass.

First version:

  • Red 89e2427505 (tests and a stub with today's behaviour: nothing restarts). ClusterServiceStaleRestartTests uses a temporary service folder and stand-ins for launchctl print and the kickstart:
    • it restarts once for 0.10.11 → 0.10.12 and W1's .175 → .176, and a second part start asks nothing;
    • it does nothing for a service on the same or a newer release (and doesn't ask launchd);
    • it does nothing for a process that isn't the supervised service's part, or the service itself;
    • it does nothing for a supervisor that isn't the job, or when no job is loaded;
    • it asks at most once per release in 6 h;
    • it reads the pid from launchctl print.
      CI on the red commit alone: DO NOT MERGE: red run for 0.10.12 pair cluster service restart after an update #2032 (DO NOT MERGE).
  • Green a6d3e6beb5: the fix.
  • Local: ProviderCore emits and darkbloom typechecks against the 0.10.12 release build's modules; ProviderCoreTests typechecks except 3 errors in files the harness can't build (MockCoordinator, unrelated). The SemanticVersion and launchctl print parsing were checked standalone. changelog check, docs-impact (vs 0b52123a18) and check-date-comparisons pass. I didn't run the tests locally: Mac A was at 21–24 GiB free.

Proof on a real update

The morning W1 delta on pair-2 can prove it: the next DevNet build with this, then update on both Macs of a local-only pair. Expected:

  • cluster part: this Mac's cluster service still runs v… while v… is installed … in each part's log;
  • then ps shows a new supervisor and service, and service-update.json says the new release, with no manual kickstart;
  • with the delta, the leading Mac's old rank 0 ends at the first SIGTERM too, instead of after the 20 s wait.

The reviewer's §8 has the full checklist.

Status

  • CI on 16b1a18bda (the review delta): all green (run 43184550744).
    • Provider Unit Tests shard 2 ran the 15 tests (with the 11 order cases) and all passed; its main run was "2857 tests in 262 suites passed".
    • In attempt 1, Cluster Runtime Tests shards 2 and 3 failed on infrastructure only: shard 2's actions/checkout hit "RPC failed; curl 92 … early EOF", and shard 3's runner never ran a step. Re-running the failed jobs (attempt 2) passed them.
  • Red run for the delta, DO NOT MERGE: red run for #2033's review delta (S1-S3) #2036 on 6ceeb398e9 (closed after reading): shard 2 failed exactly on the S1 exit test and the S2 test: 4 issues in total ("2857 tests … failed … with 4 issues"). Shard 1 and every cluster job passed.
  • First version: CI on a6d3e6beb5 was all green (run 43174492897), and shard 2 ran the 7 tests then. The red run, DO NOT MERGE: red run for 0.10.12 pair cluster service restart after an update #2032 on 89e2427505, failed exactly on those tests: 3 tests, 11 issues. Shard 1 of that run had one unrelated failure, DistributedHTTPVisibleContentTests.streamedToolCallEndsWithToolCallsFinish().

jonathan308 and others added 2 commits November 11, 2026 23:12
…r release (red)

W1-D2 (0.10.12 W1, pair-2): after `darkbloom update` on both Macs, a pair
that serves only on its local API kept both cluster services (supervisor
and service) on 0.10.10-dev.branch.175 while their parts ran .176.
The supervisor's pair cycle does not drain such a pair
(ClusterPairUpdateCycle.livePart: localOnly or solo is undrainable), so
it never restarts into the installed release; `restart` restarts only the
parts. Only a login, a supervisor crash or `launchctl kickstart -k` did.

The tests start a part of the installed release under a supervisor whose
state file names an earlier release, with launchd's `print` and the
kickstart stood in: it must restart the service's job once (W1's DevNet
build numbers and 0.10.11 -> 0.10.12), never for a service on this or a
newer release, a process that is not the supervised service's part, a
supervisor that is not the launchd job, or the same release twice within
six hours. The stub has today's behaviour (nothing restarts), so they
fail on the restart expectations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… after an update

W1-D2 (0.10.12 W1, pair-2): after `darkbloom update` on both Macs, a pair
serving only on its local API kept its cluster service (supervisor and
service) on the earlier release. The supervisor's pair cycle does not drain
such a pair (ClusterPairUpdateCycle.livePart: localOnly or a solo part is
undrainable), so it gave the restart up; the old service set the pair up
again from the installed binary, so only the parts ran the new release.
`update` again said "Already up to date" and `restart` restarted the parts.
The update to a release is decided by the release it updates from, so the
fix has to run in the new release's own processes: the parts.

ClusterServiceStaleRestart: at the start of a part of a supervised cluster
service (its heartbeat file is part-health.json, ClusterService
.partEnvironment), when the supervisor's state file names an older release
than the part's (SemanticVersion, DevNet build numbers included), the part's
parent is the service that supervisor runs, and the supervisor is the
process this build's launchd job runs, the part asks launchd to restart the
job (`launchctl kickstart -k`, in the background) and starts nothing for up
to 20 s, so the service's stop ends it before it loads a model. Once per
installed release in 6 hours (service-restart-asked.json, written before
the ask), so it can never loop. Called first in `start` (rank 0, a
coordinator-paired part, a solo server) and `cluster link-follower`; any
other process returns at once without reading a file.

Docs: cluster-always-on (the coordinated update, troubleshooting),
two-mac-cluster, cli-reference (`darkbloom update`). Changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 12, 2026 8:39am UTC
darkbloom-status Ready Ready Preview Nov 12, 2026 8:39am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 12, 2026 8:39am UTC

Request Review

…, the stop during the wait (red)

The independent review (review-2033.md S1-S3) found:

- S1: a `start` part runs under the AppKit host, which has already taken
  SIGTERM and SIGINT (ProviderSignalHandler: ignored, read by dispatch
  sources) before Start.run(). So the service's stop does not end the
  part during the 20 s wait after the ask, as the comment claimed; it
  sleeps the whole wait, then carries on starting.
- S2: the ask is made even when its 6 h record could not be written.
- S3: four of the reviewer's mutants passed the PR's tests: a plain string
  comparison of the versions, the 6 h record keyed on the supervisor's
  release, the record written after the ask, and launchctl print of
  another job.

New tests:
- the releases' order decides, never the text's: DevNet build 99 -> 100
  and 176 -> 177 (W1's morning case), 0.10.9 -> 0.10.10 and 0.10.12,
  0.10.9-dev -> 0.10.12-dev, and the reverse and equal cases;
- a newer installed release asks again within 6 h;
- launchctl print asks for this build's label, and the record is on
  disk when launchd is asked;
- a supervisor with no service running (before a re-exec) is left alone;
- `kickstart -k` is what launchctl is asked, and its refusal is said;
- an ask that can't be recorded is not made (red: S2);
- in a child with SIGTERM and SIGINT taken as the AppKit host takes them,
  a SIGTERM during the wait ends the process (red: S1), and after the
  wait the handlers are back.

Seams with today's behaviour: waitForStop(seconds:) is the plain sleep,
and kickInBackground takes the launchctl runner. Red here: the S1 and S2
tests; the order, record and label tests pass, and fail on the reviewer's
mutants (string order, M9, M12, M15, M17).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sk only once recorded

The independent review (review-2033.md, S1 and S2):

- S1: the 20 s wait after the ask did not end at the service's stop for a
  `start` part, as the earlier commit said it would. Rank 0, a
  coordinator-paired part and a solo server run under the AppKit host,
  which takes SIGTERM and SIGINT for the provider's own drain before
  Start.run() (ProviderSignalHandler: ignored, read by dispatch
  sources), so a SIGTERM was only noted: the part slept the whole wait,
  then carried on starting. Only `cluster link-follower` ended at once.
  waitForStop now gives SIGTERM and SIGINT their default action for the
  wait and then gives them back what they had (sigaction), so the stop
  ends every part at once and a part that nothing stopped starts as
  before.
- S2: the ask is made only once its 6 h record is written. A record that
  can't be written means no restart, said in the part's log, so the
  no-loop property doesn't depend on launchctl.

Docs: cluster-always-on (the coordinated update, step 4): the order is
the releases', the parent check, the record before the ask, and the
wait's signals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — 16b1a18b Deployed Nov 12, 2026 by vercel[bot]
Preview – d-inference-landing — 16b1a18b Deployed Nov 12, 2026 by vercel[bot]
Preview – darkbloom-status — 16b1a18b Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant